home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / LPC / for < prev    next >
Text File  |  2001-04-06  |  1KB  |  37 lines

  1. NAME
  2.         for
  3.  
  4. SYNTAX
  5.         for(init; expr2; expr3) statement;
  6.  
  7. DESCRIPTION
  8.         Execute <init> once. Then, while <expr2> returns a non-zero
  9.         value, execute <statement>. Every time <statement> has been
  10.         executed, or a 'continue' statement has been executed, execute
  11.         <expr3> before next loop.
  12.  
  13.         <init> is usually a series of one or more expressions (remember
  14.         that assignments are expressions, too), separated by commas.
  15.         Additionally it is also allowed to define new local variables
  16.         here and assign them an initial value. The scope of such variables
  17.         is the whole for statement.
  18.  
  19.         Examples for legal <init> expressions are:
  20.  
  21.            for (i = 0; ...
  22.            for (i = 0, j = 0; ...
  23.            for (i = 0, int j = i; ...
  24.            for (int j = 4; ...
  25.  
  26.         Illegal <init> expressions are:
  27.  
  28.            for (int i; ...      : no value assigned
  29.            for (int i += 4; ... : only plain assignments allowed
  30.  
  31.         A 'break' in the 'statement' will terminate the loop. A
  32.         'continue' will continue the execution from the beginning of
  33.         the loop.
  34.  
  35. SEE ALSO
  36.     foreach(LPC), if(LPC), do-while(LPC), while(LPC), switch(LPC)
  37.